//index.js
//获取应用实例
const app = getApp();
var request = require("../../utils/request.js");
var userInfo = require('../../utils/getuserinfo.js');
Page({
  data: {
    imgUrls: [
    ],
    lists_images:[
    ],
    currentSwiper: 0, 
    show_have: true,
    img_url:"",
    access:""
  },
  onLoad: function (a) {
    console.log(a)
    app.bindUser(a);
    //快捷导航跳转
    this.turn = request.turn;
    this.close_modal = request.close_modal; 

    this.bindGetUserInfo = userInfo.bindGetUserInfo;
    this.next_time = userInfo.next_time;
    app.getSetting(this);

    var that = this;
    var data ={
      type:1
    } 
    request.request(app.globalData.indexPic,data,function(res){
      // console.log(res)
      if (res.code == 0){
        that.setData({
          picList: res.picList,
          img_url: request.url  + "/"
        })
      }
    })

    request.request(app.globalData.getClassifyPage,{limit:10,page:1},function(res){
      // console.log(res)
      if(res.code == 0){
        that.setData({
          lists_images: res.classifyList
        })
      }
    })


    request.request(app.globalData.brandList, {}, function (res) {
      // console.log(res)
      if (res.code == 0) {
        that.setData({
          storelists: res.brandList
        })
      }
    })    
  },
  onShareAppMessage: function () {
    var user_info = wx.getStorageSync('totalInfo');
    return {
      title: "云家故事",
      path: "/pages/index/index?userId=" + user_info.userId
    }
  },

  swiperChange: function (e) {
    this.setData({
      currentSwiper: e.detail.current
    })
  },

  mine_tap:function(){
    wx.navigateTo({
      url: '/pages/mine/mine',
    })
  },
  classify_click:function(){
    wx.navigateTo({
      url: '/pages/choose_list/list',
    })
  },


})
